<template>
  <div class="goods-select-modal">
    <p>刷新</p>
    <Table stripe border ref="selection" @on-selection-change="selecttionchanges" :columns="columns4" :data="data1"></Table>
    <Button @click="ok" v-if="selectlist.length>0">确定选择</Button>
  </div>
</template>

<script>
import api from "../api";
var t;
export default {
  name: "HelloWorld",
  data() {
    return {
      selectlist:[],
      columns4: [
        {
          type: "selection",
          width: 60,
          align: "center"
        },
        {
          title: "pic",
          key: "pic"
        },
        {
          title: "title",
          key: "title"
        },
        {
          title: "创建时间",
          key: "create_time"
        }
      ],
      data1: [
      
        
      ]
    };
  },
  methods: {
    ok(){
      this.$emit('on-change',this.selectlist)
    },
    selecttionchanges(res){
       this.selectlist =res;
    },
    handleSelectAll(status) {
      this.$refs.selection.selectAll(status);
    }
  },

  mounted() {
    t = this;
    api.getgoods({
      data: { page: 1 },
      success: res => {
        t.data1=res.data
        console.log(res);
      }
    });
  }
};
</script>
